/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.mycompany.entidades;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author johnny
 */
@Entity
@Table(catalog = "celulares", schema = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Usuario.findAll", query = "SELECT u FROM Usuario u"),
    @NamedQuery(name = "Usuario.findByNick", query = "SELECT u FROM Usuario u WHERE u.nick = :nick"),
    @NamedQuery(name = "Usuario.findByPassword", query = "SELECT u FROM Usuario u WHERE u.password = :password"),
    @NamedQuery(name = "Usuario.findByRol", query = "SELECT u FROM Usuario u WHERE u.rol = :rol")})
public class Usuario
  implements Serializable
{
  private static final long serialVersionUID = 1L;

  @Id
  @Basic(optional=false)
  @Column(nullable=false, length=45)
  private String nick;

  @Column(length=45)
  private String password;
  private Integer rol;
  private Integer estado;

  public Usuario()
  {
  }

  public Usuario(String nick)
  {
    this.nick = nick;
  }

  public String getNick() {
    return this.nick;
  }

  public void setNick(String nick) {
    this.nick = nick;
  }

  public String getPassword() {
    return this.password;
  }

  public void setPassword(String password) {
    this.password = password;
  }

  public Integer getRol() {
    return this.rol;
  }

  public Integer getEstado() {
    return this.estado;
  }

  public void setEstado(Integer estado) {
    this.estado = estado;
  }

  public void setRol(Integer rol) {
    this.rol = rol;
  }

  public int hashCode()
  {
    int hash = 0;
    hash += (this.nick != null ? this.nick.hashCode() : 0);
    return hash;
  }

  public boolean equals(Object object)
  {
    if (!(object instanceof Usuario)) {
      return false;
    }
    Usuario other = (Usuario)object;
    if (((this.nick == null) && (other.nick != null)) || ((this.nick != null) && (!this.nick.equals(other.nick)))) {
      return false;
    }
    return true;
  }

  public String toString()
  {
    return "com.mycompany.entidades.Usuario[ nick=" + this.nick + " ]";
  }
}